package com.dk.service.impl;

import com.dk.mapper.CmsChanelMapper;
import com.dk.pojo.CmsChanel;
import com.dk.service.CmsChanelServiceI;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CmsChanelServiceImpl implements CmsChanelServiceI {

    @Autowired
    private CmsChanelMapper cmsChanelMapper;

    @Override
    public PageInfo<CmsChanel> getInfoServer(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<CmsChanel> list = cmsChanelMapper.getInfoServer();
        PageInfo<CmsChanel> page = new PageInfo<>(list);
        return page;
    }

    @Override
    public CmsChanel getUpdate(Integer channelId) {
        return cmsChanelMapper.selectByPrimaryKey(channelId);
    }

    @Override
    public CmsChanel getInfos(CmsChanel cmsChanel) {
        return cmsChanelMapper.getInfos(cmsChanel);
    }

    @Override
    public void updateInfo(CmsChanel cmsChanel) {
        cmsChanelMapper.updateByPrimaryKeySelective(cmsChanel);
    }

    @Override
    public CmsChanel getInfors(CmsChanel cmsChane2) {
        return cmsChanelMapper.getInfors(cmsChane2);
    }
}
